package service

import (
	log "github.com/sirupsen/logrus"
	"runtime"
	"usbipproxy/domain/vo"
)

type UsbIpInfo struct {
	Vendor  string `json:"vendor"`
	Product string `json:"product"`
}

type UsbIpServerCmdService interface {
	List() []*vo.UsbInfo
	UnBind(busId string) (bool, error)
	Bind(busId string) (bool, error)
}

var FactoryUsbIpServerCmd = &UsbIpServerCmdServiceFactory{}

type UsbIpServerCmdServiceFactory struct{}

func (f *UsbIpServerCmdServiceFactory) Create() UsbIpServerCmdService {
	os := runtime.GOOS
	switch os {
	case "windows":
		log.Infof("当前是 Windows 系统")
		return NewUsbIpServerWindowsCmdServiceImpl()
	case "linux":
		log.Infof("当前是 Linux 系统")
		return NewUsbIpServerLinuxCmdServiceImpl()
	default:
		log.Infof("当前是其他系统：%s\n", os)
	}
	return nil
}
